from rest_framework import serializers

from datasource.models import CameraList
from dvadmin.utils.serializers import CustomModelSerializer
from dvadmin.utils.viewset import CustomModelViewSet


class CameraSerializer(CustomModelSerializer):

    class Meta:
        model = CameraList
        fields = "__all__"

    def create(self, validated_data):
        return super().create(validated_data)
class CameraViewSet(CustomModelViewSet):
    """
    摄像机管理接口
    list:查询
    create:新增
    update:修改
    retrieve:单例
    destroy:删除
    """
    queryset = CameraList.objects.all()
    serializer_class = CameraSerializer
    filter_fields = ['name', ]
    permission_classes = []
